﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DBControl;
///使用AJAX关闭购买需求，在detail.aspx页面实用.
///胡俊凯2011-07-13
namespace ProjectX.AjaxCommand
{
    /// <summary>
    /// CloseBuy 的摘要说明
    /// </summary>
    public class CloseBuy : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string buyid = context.Request.Form["buyid"];
            string closestr = "UPDATE BuyersinfoR SET [Status] = 1 WHERE Id='" + buyid + "'";
            try
            {
                SqlDbHelper sdh = new SqlDbHelper();
                int i = sdh.ExecuteNonQuery(closestr);
                if (i != 0)
                {
                    context.Response.Write("ok");
                    context.Response.End();
                }
                else
                {
                    context.Response.Write("norow");
                    context.Response.End();
                }
            }
            catch (Exception)
            {
                context.Response.Write("error");
                context.Response.End();
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}